Verify `cargo package` rejects path dependencies.
authorRalph Giles <giles@mozilla.com>
Wed, 31 Aug 2016 23:13:26 +0000 (16:13 -0700)
committerRalph Giles <giles@mozilla.com>
Wed, 31 Aug 2016 23:13:26 +0000 (16:13 -0700)
Port of the equivalent test from the `cargo publish` command.

tests/package.rs

index b953c3916c69bc4ace396f1e521a3faeb7a5aaa9..c9bbfd0f72c3c7d08946788e7910153441851dd0 100644 (file)
@@ -206,6 +206,37 @@ fn package_verification() {
         dir = p.url())));
 }
 
+#[test]
+fn path_dependency_no_version() {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [project]
+            name = "foo"
+            version = "0.0.1"
+            authors = []
+            license = "MIT"
+            description = "foo"
+
+            [dependencies.bar]
+            path = "bar"
+        "#)
+        .file("src/main.rs", "fn main() {}")
+        .file("bar/Cargo.toml", r#"
+            [package]
+            name = "bar"
+            version = "0.0.1"
+            authors = []
+        "#)
+        .file("bar/src/lib.rs", "");
+
+    assert_that(p.cargo_process("package"),
+                execs().with_status(101).with_stderr("\
+[WARNING] manifest has no documentation, homepage or repository. See http://doc.crates.io/manifest.html#package-metadata for more info.
+[ERROR] all path dependencies must have a version specified when packaging.
+dependency `bar` does not specify a version.
+"));
+}
+
 #[test]
 fn exclude() {
     let p = project("foo")